home *** CD-ROM | disk | FTP | other *** search
/ Mac Easy 2010 May / Mac Life Ubuntu.iso / casper / filesystem.squashfs / usr / share / system-config-printer / troubleshoot / CheckPrinterSanity.pyc (.txt) < prev    next >
Encoding:
Python Compiled Bytecode  |  2009-10-12  |  3.5 KB  |  52 lines

  1. # Source Generated with Decompyle++
  2. # File: in.pyc (Python 2.6)
  3.  
  4. import cups
  5. import gobject
  6. import os
  7. import smburi
  8. import subprocess
  9. from timedops import TimedOperation, TimedSubprocess
  10. import urllib
  11. from base import *
  12.  
  13. class CheckPrinterSanity(Question):
  14.     
  15.     def __init__(self, troubleshooter):
  16.         Question.__init__(self, troubleshooter, 'Check printer sanity')
  17.         troubleshooter.new_page(gtk.Label(), self)
  18.         self.troubleshooter = troubleshooter
  19.  
  20.     
  21.     def display(self):
  22.         self.answers = { }
  23.         answers = self.troubleshooter.answers
  24.         if not answers['cups_queue_listed']:
  25.             return False
  26.         name = answers['cups_queue']
  27.         parent = self.troubleshooter.get_window()
  28.         
  29.         try:
  30.             cups.setServer('')
  31.             c = TimedOperation(cups.Connection, parent = parent).run()
  32.             printers = TimedOperation(c.getPrinters, parent = parent).run()
  33.             if printers.has_key(name):
  34.                 self.answers['is_cups_class'] = False
  35.                 queue = printers[name]
  36.                 self.answers['cups_printer_dict'] = queue
  37.             else:
  38.                 self.answers['is_cups_class'] = True
  39.                 classes = TimedOperation(c.getClasses, parent = parent).run()
  40.                 queue = classes[name]
  41.                 self.answers['cups_class_dict'] = queue
  42.         except:
  43.             answers['cups_queue_listed']
  44.  
  45.         return False
  46.  
  47.     
  48.     def collect_answer(self):
  49.         return self.answers
  50.  
  51.  
  52.